#ifndef __XSIP_H__
#define __XSIP_H__
#include "libxsip.h"
#include "DelayQueue.hh"

class XSIPPayloadOffsetHeader {
public:
	XSIPPayloadOffsetHeader(XSIPHeader::header* header);
	int getContentIndex();
	int getDataSize();
	int getContentTotalSize();

	static char* getPayloadOffset(int i, int size, int total);
private:
	int m_contentIndex;
	int m_dataSize;
	int m_contentTotalSize;
};

class XSIPPayloadOffsetAckHeader {
public:
	XSIPPayloadOffsetAckHeader(XSIPHeader::header* header);
	int getAck();

	static char* getPayloadOffsetAck(int ack);
private:
	int m_ack;
};

class Process {
public:
	static void processInviteRequest(XSIPTransport* transport, XSIPRequest* request);
	static void processReInviteRequest(XSIPTransport* transport, XSIPDialog* dialog, XSIPRequest* request);
	static void processInviteResponse(XSIPDialog* dialog, XSIPTransaction* transaction, XSIPResponse* response);
	static void processAck(XSIPDialog* dialog, XSIPTransaction* transaction, XSIPRequest* ack);

	static void processRequest(XSIPTransport* transport, XSIPRequest* request);
	static void processResponse(XSIPTransaction* transaction, XSIPResponse* response);
	
	static void processResponse(XSIPTransaction* transaction, XSIPPayloadOffsetHeader* payloadOffset, XSIPResponse* response);
	static void processRequest(XSIPTransaction* transaction, XSIPPayloadOffsetAckHeader* ack);

	static void processRequest(XSIPTransport* transport, XSIPPayloadOffsetHeader* payloadOffset, XSIPRequest* request);
	static void processRequest(XSIPTransaction* transaction, XSIPPayloadOffsetHeader* payloadOffset, XSIPRequest* request);
	static void processResponse(XSIPTransaction* transaction, XSIPPayloadOffsetAckHeader* ack);
};

class DeleteCall : public DelayQueueEntry {
public:
	DeleteCall(XSIPCall* call);
	virtual ~DeleteCall();
	virtual void handleTimeout();
private:
	XSIPCall *m_call;
};

#endif
